
{{$shortStructName:= FirstLetterLower .TableDetailResp.StructName}}
-- 菜单 SQL
select max(id) into @min_menu_id from sys_menu;
set @min_menu_id = IFNULL(@min_menu_id, 0) + 1;
insert into sys_menu (id,menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, created_by, created_at, updated_by, updated_at, remark)
values(@min_menu_id,'{{.TableDetailResp.FunctionName}}', '{{.TableDetailResp.ParentMenuId}}', '1', '{{$shortStructName}}', '{{.TableDetailResp.ModuleName}}/{{$shortStructName}}/index', 1, 0, 'C', '0', '0', '{{.PermissionPrefix}}:list', '#', 'admin', sysdate(), '', null, '{{.TableDetailResp.FunctionName}}菜单');

-- 按钮父菜单ID
set @parentId = @min_menu_id;

-- 按钮 SQL
set @min_menu_id = @min_menu_id + 1;
insert into sys_menu (id,menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, created_by, created_at, updated_by, updated_at, remark)
values(@min_menu_id, '{{.TableDetailResp.FunctionName}}查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', '{{.PermissionPrefix}}:query',        '#', 'admin', sysdate(), '', null, '');

set @min_menu_id = @min_menu_id + 1;
insert into sys_menu (id,menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, created_by, created_at, updated_by, updated_at, remark)
values(@min_menu_id,'{{.TableDetailResp.FunctionName}}新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', '{{.PermissionPrefix}}:add',          '#', 'admin', sysdate(), '', null, '');

set @min_menu_id = @min_menu_id + 1;
insert into sys_menu (id,menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, created_by, created_at, updated_by, updated_at, remark)
values(@min_menu_id,'{{.TableDetailResp.FunctionName}}修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', '{{.PermissionPrefix}}:edit',         '#', 'admin', sysdate(), '', null, '');

set @min_menu_id = @min_menu_id + 1;
insert into sys_menu (id,menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, created_by, created_at, updated_by, updated_at, remark)
values(@min_menu_id,'{{.TableDetailResp.FunctionName}}删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', '{{.PermissionPrefix}}:remove',       '#', 'admin', sysdate(), '', null, '');

set @min_menu_id = @min_menu_id + 1;
insert into sys_menu (id,menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, created_by, created_at, updated_by, updated_at, remark)
values(@min_menu_id,'{{.TableDetailResp.FunctionName}}导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', '{{.PermissionPrefix}}:export',       '#', 'admin', sysdate(), '', null, '');